//引入模板
const express=require('express');
//引入连接池模板
const pool=require('../pool.js');
//创建路由器对象
const u=express.Router();
//1.宠物店项目功能查询(首页)
u.get("/pet_product",(req,res) => {
	var  sql = "select * from pet_product";
	pool.query(sql,[],(err,result) => {
		if(err) throw err;
		res.send({ message: 'ok', code: 200 ,result});
	});
});

//2.大轮播图查询
u.get("/big_carousel",(req,res) => {
	var  sql = "select * from big_carousel";
	pool.query(sql,[],(err,result) => {
		if(err) throw err;
		console.log(result);
		res.send({ message: 'ok', code: 200 ,result});
	});
});
//3.小轮播图查询
u.get("/small_carousel",(req,res) => {
	var  sql = "select * from small_carousel";
	pool.query(sql,[],(err,result) => {
		if(err) throw err;
		console.log(result);
		res.send({ message: 'ok', code: 200 ,result});
	});
});
//4.医疗设施查询
u.get("/pet_facilities",(req,res) => {
	var  sql = "select * from pet_facilities";
	pool.query(sql,[],(err,result) => {
		if(err) throw err;
		console.log(result);
		res.send({ message: 'ok', code: 200 ,result});
	});
});
//5.首页宠物百科栏目文章查询
u.get("/index_article",(req,res) => {
	var  sql = "select * from index_article";
	pool.query(sql,[],(err,result) => {
		if(err) throw err;
		console.log(result);
		res.send({ message: 'ok', code: 200 ,result});
	});
});
//6.查询首页介绍文章
u.get("/index_introduce",(req,res) => {
	var  sql = "select * from index_introduce";
	pool.query(sql,[],(err,result) => {
		if(err) throw err;
		console.log(result);
		res.send({ message: 'ok', code: 200 ,result});
	});
});
//6.查询首页愿景
u.get("/pet_vision",(req,res) => {
	var  sql = "select * from pet_vision";
	pool.query(sql,[],(err,result) => {
		if(err) throw err;
		console.log(result);
		res.send({ message: 'ok', code: 200 ,result});
	});
});
//导出路由器对象
module.exports=u;